#ifndef NOOS_DISTANCE_MATRIX
#define NOOS_DISTANCE_MATRIX

/* Class that stores the projection distances: */ 
class NOOSDistanceMatrix {
	friend class AW_LVP_NOOS2DProjection;
	friend class AW_LVP_NOOS3DProjection;

public:
	NOOSDistanceMatrix(FTKBase *cb,Sort *s);
	~NOOSDistanceMatrix(void);

	bool need_to_recompute(FTKBase *cb,Sort *s);

	float get_progress(void);
	bool is_finished(void);
	Sort *get_sort(void);


private:

	float distance(FeatureTerm *f1,FeatureTerm *f2,List<Path> *paths);
	float simple_feature_similarity(FeatureTerm *f1,FeatureTerm *f2);

	static void *launch_thread(void *dm);
	virtual void thread(void);

	Sort *m_sort;
	List<FeatureTerm> m_projection_cases;
	List<FeatureTerm> m_projection_descriptions;
	List<FeatureTerm> m_projection_solutions;
	float *m_projection_matrix;
	
	float m_progress;
	bool m_finished;

	pthread_t m_thread;
	pthread_attr_t m_thread_attr;
};


#endif